import java.util.ArrayList;
import java.util.List;

public class Enimy extends Tank {
List<Shot> shots = new ArrayList<>();
    static final int MAX_SHOTS = 1;  // 每个敌人最多同时发射1颗子弹

    public Enimy(int x, int y) {
        super(x, y);
    }
    
    public void shotEnemy() {
        if (shots.size() >= MAX_SHOTS) {
            return;
        }
        Shot shot = null;
        switch (getDirect()) {
            case 0:
                shot = new Shot(getX() + 20, getY(), 0);
                break;
            case 1:
                shot = new Shot(getX() + 60, getY() + 20, 1);
                break;
            case 2:
                shot = new Shot(getX() + 20, getY() + 60, 2);
                break;
            case 3:
                shot = new Shot(getX(), getY() + 20, 3);
                break;
        }
        if (shot != null) {
            shots.add(shot);
            new Thread(shot).start();
        }
    }
}
